<div id="content-flash">
    <?php if($this->session->flashdata('category') != null){ ?>
    <p id="content-notif">
        <?php
        echo $this->session->flashdata('category');
        ?>
    </p>
    <?php } ?>
</div>
<div id="content-title">
    <p id="ctitle-p">
        List Category
    </p>
</div>
<div class="hor-line"></div>
<div id="content">
    <div id="user-menu">
        <div id="add-category">
            <a href="<?php echo base_url().'cp/add_category/';?>">
                + Add category
            </a>
        </div>
    </div>
    <table id="table-category">
        <tr class="tr-title">
            <td class="td-no">
                No
            </td>
            <td class="td-title">
                Category Name
            </td>
            <td class="td-published">
                Published
            </td>
            <td class="td-total">
                Total Article
            </td>
            <td class="td-action"">
                Action
            </td>
        </tr>
        <?php 
        $count = 1;
        foreach($category->result() as $row){
        ?>
        <tr <?php echo (($count % 2) == 0) ? 'class="tr-round"' : '';?>>
            <td class="td-no"><?php echo $count;?></td>
            <td class="td-title"><?php echo $row->category_name;?></td>
            <td class="td-published"><?php echo ($row->category_published) ? 'Yes' : 'No';?></td>
            <td class="td-total"><?php echo $row->total_article;?></td>
            <td class="td-action">
                <a href="<?php echo base_url().'cp/edit_category/'.$row->category_id;?>">
                    Edit
                </a>
                <a href="<?php echo base_url().'category/delete/'.$row->category_id;?>">
                    Delete
                </a>
            </td>
        </tr>
        <?php
            $count++;
        }
        ?>
    </table>
</div>